package hu.kisprof.quizServer.controller;


import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class QuizServerIncomingConnectionListener extends  Thread {
	//private static final int PORT = 23544;
	private QuizServerController controller;
	private ServerSocket ss;
	public QuizServerIncomingConnectionListener(QuizServerController controller){
		this.controller = controller;
		this.setName("ConnectionListener");
	}
	
	
	public void run() {
		try {
			ss = new ServerSocket(hu.kisprof.quiz.model.QuizDAO.port);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		while (true){
			Socket incoming = null;
			
			try {
				incoming = ss.accept();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				continue;
			}
			new QuizServerIncomingConnection(incoming,controller).start();
		}
	}

	
	
	

}